package no.uib.hplims.tools.columngenerators;

import no.uib.hplims.MyVaadinApplication;
import no.uib.hplims.models.Peptide;

import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.ColumnGenerator;

public class TimesOrderedColumnGenerator implements ColumnGenerator {
	
	private static final long serialVersionUID = 2896445760813763589L;

	public Object generateCell(Table source, Object itemId, Object columnId) {
		Peptide p = (Peptide) itemId;
		int orderedTimes = MyVaadinApplication.getInstance().getController()
				.getNumberOfTimesPreviouslyOrdered(p.getPeptideSequence());

		Label l = new Label(orderedTimes + "x before");
		l.setStyleName("miniinfo");
		return l;
	}

}
